home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / mint / mntlib43 / mntlib / link.c < prev    next >
C/C++ Source or Header  |  1993-09-15  |  483b  |  36 lines

  1. /* make a hard link */
  2.  
  3. #include <errno.h>
  4. #include <mintbind.h>
  5. #include <param.h>
  6. #include <unistd.h>
  7. #include "lib.h"
  8.  
  9. extern int __mint;
  10.  
  11. /*
  12.  * if MiNT is not active, we try to fail gracefully
  13.  */
  14.  
  15. int
  16. link(_old, _new)
  17.     const char *_old, *_new;
  18. {
  19.     long r;
  20.     char old[MAXPATHLEN], new[MAXPATHLEN];
  21.  
  22.     if (__mint < 9) {
  23.         errno = EXDEV;
  24.         return -1;
  25.     }
  26.     _unx2dos(_old, old);
  27.     _unx2dos(_new, new);
  28.  
  29.     r = Flink(old, new);
  30.     if (r < 0) {
  31.         errno = (int) -r;
  32.         return -1;
  33.     }
  34.     return 0;
  35. }
  36.